package com.lecing.dao;

import org.apache.ibatis.annotations.Param;
import org.mybatis.spring.SqlSessionTemplate;
import org.springframework.stereotype.Repository;

import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * 放款DAO
 * 关联表：cord_out
 * Created by liucs on 2018/5/25.
 */
@Repository
public class PayLoanDao {
    private static final String namespace="com.lecing.dao.PayLoanDao.";
    @Resource
    private SqlSessionTemplate session;
    /**
     * 查询月付放款-月明细
     * @param map
     * @return
     */
    public List<Map<String,Object>> selectMPayLoanData(Map<String,String> map){
        /**
        Map<String, Object> map = new HashMap<>();
        map.put("month",month);
        map.put("rity","2001");
         */
//        List<Map<String,Object>> mPayLoans=new ArrayList<>();
//        System.out.println("====selectMpayLoan====:"+month+"city:"+map.get("rity"));
//        List<Map<String,Object>> mPayLoans= session.selectList(namespace+"selectMPayLoanLst",month);
        System.out.println( map.get("rity")+":"+map.get("month"));
        List<Map<String,Object>> mPayLoans=session.selectList(namespace+"selectMPayLoanLst",map);
        System.out.println("返还结果："+mPayLoans.size());
        return mPayLoans;
    }


    /**
     * 查询年付放款月明细
     * @param statMonth
     * @return
     */
    public List<Map<String,Object>> selectYPayLoanData(@Param("statMonth") String statMonth){
        System.out.println("selectYPayLoan:"+statMonth);
        List<Map<String,Object>> yPayLoans=new ArrayList<>();
        yPayLoans = session.selectList(namespace+"selectYPayLoanData",statMonth);
        return  yPayLoans;
    }

    /**
     * 查询月付放款日交易凭证
     * @param traDate
     * @return
     */
    public List<Map<String,Object>> selectMTraCert(String traDate){
        List<Map<String,Object>> loanTraCerts= session.selectList(namespace+"selectLoanTraCert",traDate);
        return loanTraCerts;
    }

    /**
     * 根据交易码查询放款明细
     * @param traCode
     * @return
     */
    public List<Map<String,Object>> selectMLoanDetail(@Param("tc") String traCode){
        List<Map<String,Object>> loanDetails=session.selectList(namespace+"selectMLoanDetail",traCode);
        return loanDetails;
    }
    /**
     * 查询年付放款月明细
     * @param maps
     * @return
     */
    /**
    public List<YPayLoan> selectYPayLoan1( Map<String,String> maps){
        System.out.println("map:"+maps);
        List<YPayLoan> yPayLoans=new ArrayList<>();
        yPayLoans = session.selectList(namespace+"selectYPayLoanData",maps);
        return  yPayLoans;
    }
     */
}
